package de.tudarmstadt.fgbs.cafe.validation;

import de.tudarmstadt.fgbs.cafe.plugin.ValidationPluginInterface;
import de.tudarmstadt.fgbs.cafe.structure.Fahrplan;
import de.tudarmstadt.fgbs.cafe.structure.beans.ValidationBean;
import de.tudarmstadt.fgbs.cafe.structure.enumeration.ValidationStatus;

/**
 * Class which realizes a demo mode of the validation plugin. The method returns
 * a different result on every call to present the possible states.
 * 
 * @author Christian Schlehuber
 * @version 0.4
 * @since 0.4
 * 
 */
public class DemoValidator implements ValidationPluginInterface {

    /**
     * Counter variable for the number of calls made to the method
     */
    private int call = 0;

    @Override
    public ValidationBean validateFPL(Fahrplan fpl) {
	ValidationBean vBean = null;

	if ((call % 3) == 0)
	    vBean = new ValidationBean(ValidationStatus.SUCCESSFUL);
	else if ((call % 3) == 1)
	    vBean = new ValidationBean(ValidationStatus.WARNING);
	else if ((call % 3) == 2)
	    vBean = new ValidationBean(ValidationStatus.ERROR);

	call++;

	return vBean;
    }

}
